<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="Bookmark" href="/favicon.ico" >
    <link rel="Shortcut Icon" href="/favicon.ico" />
    <!--[if lt IE 9]>
    <script type="text/javascript" src="/public/js/html5shiv.js"></script>
    <script type="text/javascript" src="/public/js/respond.min.js"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="/public/plugins/h-ui/css/H-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="/public/plugins/h-ui.admin/css/H-ui.admin.css" />
    <link rel="stylesheet" type="text/css" href="/public/plugins/Hui-iconfont/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="/public/plugins/h-ui.admin/skin/default/skin.css" id="skin" />
    <link rel="stylesheet" type="text/css" href="/public/plugins/h-ui.admin/css/style.css" />
    <link rel="stylesheet" type="text/css" href="/public/plugins/laydate/skins/default/laydate.css"/>
    <!--[if IE 6]>
    <script type="text/javascript" src="/public/js/DD_belatedPNG_0.0.8a-min.js" ></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="/public/plugins/datatables/buttons.dataTables.min.css">
    <title>快方管理后台</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <style type="text/css">
        .date{
            width: 100px;
        }
    </style>
</head>
<body class="big-page">

<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 订单管理 <span
        class="c-gray en">&gt;</span> 订单导航 <a class="btn btn-success radius r"  style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新">
        <i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="Hui-article">
    <article class="cl pd-20">
        
        <div class="mt-10">
            <table class="table table-border table-bordered table-bg table-hover table-sort table-responsive" id="dataTables">
                <thead>
                <tr class="text-c">
                    <th>快方订单号</th>
                    <th>药店经纬度</th>
                    <th>客户经纬度</th>
                    <th>编辑</th>
                </tr>
                </thead>
                <tbody>
                    <?php foreach($order_list as $r) :?>
                    <tr>
                        <td><?=$r['order_id']?></td>
                        <td><?=$r['location'][0]?></td>
                        <td><?=$r['location'][1]?></td>
                        <td><a class="order_position" href="/ThirdOrder/Walking?store=<?=$r['location'][0]?>&customer=<?=$r['location'][1]?>">步行导航</a></td>
                    </tr>
                    <? endforeach?>
                </tbody>
            </table>
        </div>
    </article>
</div>

<script type="text/javascript" src="/public/js/jquery.min.js"></script>
<script type="text/javascript" src="/public/plugins/layer/layer.js"></script>
<script type="text/javascript" src="/public/plugins/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="/public/plugins/h-ui.admin/js/H-ui.admin.js"></script>
<script type="text/javascript" src="/public/plugins/jquery.contextmenu/jquery.contextmenu.r2.js"></script>
<script type="text/javascript" src="/public/plugins/datatables/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="/public/plugins/laydate/laydate.js"></script>
<script type="text/javascript" src="/public/plugins/datatables/dataTables.buttons.min.js"></script>
<script type="text/javascript" src="/public/plugins/datatables/jszip.min.js"></script>
<script type="text/javascript" src="/public/plugins/datatables/buttons.html5.min.js"></script>
<script type="text/javascript">
    $('.date').on('click', function () {
        laydate({format: 'YYYY-MM-DD', istime: false})
    });
    
    function getDHList(){
        var DH = new Array();

        $("input[name='DH\[\]'").each(function(){
            if(typeof($(this).val()) != "undefined"){
                DH.push($(this).val());
            }
            
        })

        return DH;
    }

    $("select[name='storeId']").val("<?=$_GET['storeId']?>");
    $("select[name='platformId']").val("<?=$_GET['platformId']?>");
    $("select[name='ZT']").val("<?=$_GET['ZT']?>");
    function myrefresh() 
    { 
        var order_id = getDHList();

        if(order_id.lenght < 1){
            return false;
        }

        $.ajax({
            url : "/ThirdOrder/updateOrderStatus",
            type: "POST",
            dataType: "json",
            data: {"order_id" : order_id},
            success:function(res){
                for(k in res.data)
                {
                    $('#delivery_status_' + k).html(res.data[k]['ZT']);
                }
            }
        })

    } 
    setInterval(function(){
       myrefresh()
    },5000); //指定5秒刷新一次 
    

    $(document).on("click", ".order_status", function(){
        var id = $(this).data("id");

        layer.open({
          type: 2,
          title: '订单状态',
          shadeClose: true,
          shade: 0.8,
          area: ['800px', '75%'],
          content: '/ThirdOrder/orderStatus?id=' + id
        }); 
    })

    $(document).on("click", ".order_fee", function(){
        var order_id = $(this).data("dh");

        layer.open({
          type: 2,
          title: '配送费用',
          shadeClose: true,
          shade: 0.8,
          area: ['500px', '400px'],
          content: '/ThirdOrder/orderFee?order_id=' + order_id
        }); 
    })

    $(document).on("click", ".order_detail", function(){
        var id = $(this).data("id");

        layer.open({
          type: 2,
          title: '订单详情',
          shadeClose: true,
          shade: 0.8,
          area: ['500px', '450px'],
          content: '/ThirdOrder/orderDetail?id=' + id
        }); 
    })

    $(document).on("click", ".order_position", function(){
        var href = $(this).attr("href");

        layer.open({
          type: 2,
          title: '骑手位置',
          shadeClose: true,
          shade: 0.8,
          area: ['80%', '80%'],
          content: href
        }); 

        return false;
    })

    $("#export_all").bind("click", function(){
        window.location.href = "/ThirdOrder/exportExcel" + window.location.search;

    })

    $("select[name='is_success']").val("<?=isset($_GET['is_success']) ? $_GET['is_success'] : ''?>");
    $("select[name='sync_status']").val("<?=isset($_GET['sync_status']) ? $_GET['sync_status'] : ''?>");
    $("select[name='status']").val("<?=isset($_GET['status']) ? $_GET['status'] : ''?>");

    $("select[name='date_key']").val("<?=isset($_GET['date_key']) ? $_GET['date_key'] : ''?>");
    
    $("input[name='start_date']").val("<?=isset($_GET['start_date']) ? $_GET['start_date'] : ''?>");
    $("input[name='end_date']").val("<?=isset($_GET['end_date']) ? $_GET['end_date'] : ''?>");

    $("select[name='date_key']").bind("change", function(){
        if($(this).val() != '' && $("input[name='start_date']").val() == ""){
            $("input[name='start_date']").val("<?=date("Y-m-d", strtotime("-7 day"))?>");
            $("input[name='end_date']").val("<?=date("Y-m-d")?>");
        }
    });
</script>
</body>
</html>